-
Notifications
You must be signed in to change notification settings - Fork 0
Completed HW5 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Rewrite README with full description of BioSeqTools
SidorinAnton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Новый код и РИДМИ выглядят хорошо, однако оч жалко, что не поправлены моменты в aminoacids_tools и dna_rna_tools.
Вот отсюда:
Второй момент -- кеш пайчарма и .DS_Store. Этого в репе быть не должно )))
Никита рассказывал про файл .gitignore ну и + нужно хотя бы перед коммитом сделать git status ))
Ну и последнее:
- файлы в либах не принято называть с заглавных букв (т.е. Modules --> modules)
- название modules тоже не оч хорошее. Можно было бы назвать в духе bio_tools
- весь код в 1 коммите -- оч такое себе ))
| from typing import Dict | ||
|
|
||
|
|
||
| def calculate_percentage(seq: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Честно говоря, из названия не оч понятно, что за процент
| for amino_acid, count in amino_acid_counts.items(): | ||
| percentage = round(((count / total_amino_acids) * 100), 2) | ||
| amino_acid_percentages[amino_acid] = percentage | ||
| return f'Amino acids percentage of the sequence {seq}: {amino_acid_percentages}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Всё-таки тут лучше возвращать именно словарь (amino_acid_percentages), т.к. он может понадобиться при расчете чего-то другого. Отображение можно сделать в другой функции, которая как раз принимала бы этот словарь
| weight = 18.02 # for the H and OH at the termini | ||
| for amino_acid in seq: | ||
| weight += amino_acid_weights[amino_acid] | ||
| return f'Molecular weight of the sequence {seq}: {round(weight, 2)} Da' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Та же история, что тут лучше возвращать число. Для отображения можно завести другую функцию
| return f'Molecular weight of the sequence {seq}: {round(weight, 2)} Da' | ||
|
|
||
|
|
||
| def calculate_hydrophobicity_eisenberg(sequence): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нет типов :(
| return f"Sequence {sequence}: Neutral" | ||
|
|
||
|
|
||
| def calculate_pI(sequence): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нет типов :(
| motif_idx += 1 | ||
| else: | ||
| break | ||
| if motif_idx == len(motif): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А разве тут не всегда True?
| while seq_idx < len(seq): | ||
| motif_idx = 0 | ||
| chars_at_motif_idx = motif[motif_idx] | ||
| seq_char = seq[seq_idx] | ||
| if seq_char in chars_at_motif_idx: | ||
| motif_idx += 1 | ||
| while motif_idx < len(motif): | ||
| chars_at_motif_idx = motif[motif_idx] | ||
| seq_char = seq[seq_idx+motif_idx] | ||
| if seq_char in chars_at_motif_idx: | ||
| motif_idx += 1 | ||
| else: | ||
| break | ||
| if motif_idx == len(motif): | ||
| cleavage_sites.append(seq_idx + motif_idx) | ||
| seq_idx += 1 | ||
| return cleavage_sites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def is_peptide(seq: str) -> bool: | ||
| "Check whether the incoming sequence is an aminoacid" | ||
| if set(seq).issubset(all_aminoacids): # if set(seq) <= all_aminoacids | ||
| return True | ||
| raise ValueError(f'Incoming sequence {seq} is not a peptide') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def complement(sequence): | ||
| complement_dict = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'a': 't', | ||
| 't': 'a', 'c': 'g', 'g': 'c'} | ||
| complement_sequence = ''.join(complement_dict.get(base, base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опять .get
| def reverse_complement(dna_sequence): | ||
| # можно также "complement_sequence = complement(dna_sequence)" | ||
| complement_dict = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'a': 't', | ||
| 't': 'a', 'c': 'g', 'g': 'c'} | ||
| complement_sequence = ''.join(complement_dict.get(base, base) | ||
| for base in dna_sequence) | ||
| return complement_sequence[::-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть же функции для reverse и complement


HW5 has been completed.